package eteam.aps.controller;

import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.common.helper.JsonPage;
import eteam.aps.model.entity.ParamInfo;
import eteam.aps.model.vo.ParamFromWindowingVo;
import eteam.aps.model.vo.ParamInfoDtlVo;
import eteam.aps.model.vo.ParamInfoVo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 参数信息控制器
 *
 * @author WMT
 */
public interface IParamInfoController {

    @PostMapping("/dp/insert")
    R<Integer> insert(@RequestBody ParamInfo paramInfo) throws Exception, AuthException;

    @PostMapping("/dp/delete/{fId}")
    R<Integer> delete(@PathVariable String fId) throws Exception, AuthException;

    @PostMapping("/dp/update")
    R<Integer> update(@RequestBody ParamInfo paramInfo) throws Exception, AuthException;

    /**
     * 分页 模糊 查询
     *
     * @param fParamCode  字典编码
     * @param fParamName  字典名称
     * @param page     第几页 从1开始 必传
     * @param pageSize 每页条数 必传
     * @return 字典 详情
     * @throws Exception     顶级异常
     * @throws AuthException 授权异常
     */
    @PostMapping("/dp/selectAll")
    R<JsonPage<ParamInfoVo>> selectAll(
            @RequestParam(value = "fParamCode",required = false) String fParamCode,
            @RequestParam(value = "fParamName", required = false) String fParamName,
            @RequestParam("page") Integer page,
            @RequestParam("pageSize") Integer pageSize
    ) throws Exception, AuthException;

    @PostMapping("/dp/selectDetails/{fId}")
    R<ParamInfoVo> selectDetails(@PathVariable String fId) throws Exception, AuthException;

    @PostMapping("/dp/selectFw/{paramFrom}")
    R<List<ParamFromWindowingVo>> selectFromWindowing(@PathVariable Integer paramFrom) throws Exception, AuthException;

    @PostMapping("/dp/selectParamDtl")
    R<List<ParamInfoDtlVo>> selectParamDtl() throws Exception, AuthException;

}
